package queue

import "go-guide/data-structures/array"

// 底层通过数组实现
type ArrayQueue struct {
	arr *array.Array
}

func (a *ArrayQueue) GetSize() int {
	return a.arr.Size()
}

func (a *ArrayQueue) IsEmpty() bool {
	return a.arr.Empty()
}

func (a *ArrayQueue) Enqueue(e interface{}) {
	a.arr.AddLast(e)
}

func (a *ArrayQueue) Dequeue() {
	a.arr.Remove(0)
}

func (a *ArrayQueue) Poll() interface{} {
	return a.arr.Remove(0)
}

func (a *ArrayQueue) Element() interface{} {
	return a.arr.Get(0)
}

func (a *ArrayQueue) Take() interface{} {
	return a.arr.Remove(0)
}

func (a *ArrayQueue) Peek() interface{} {
	return a.arr.Remove(0)
}
